
# 读文件
file1 = open(r"C:\Users\lainiao\Desktop\地方.txt",encoding='utf-8')
# 将文件按照行放入链表
lines = file1.readlines()
# 准备ID链表
listTemp = []
# 放入ID链表
for line in lines:
    temps = line.replace('\n','').split(',')
    for temp in temps:
        if len(temp)>0:
            listTemp.append(temp)
print(listTemp)

# 列表化
file2 = open(r"C:\Users\lainiao\Desktop\data.txt", 'w', encoding='utf-8')
for node in listTemp:
    file2.write(node)
    file2.write('\n')
file2.close()